<template>
    <titleCompt title="排名轮播表模板">
      <div class="tscxbox">
        <scrollBoard
          v-if="this.rowData.length"
          :config="config"
          class="tscxbox-chart"
        />
      </div>
    </titleCompt>
  </template>
  
  
  <script>
    import titleCompt from "@/views/金四决策指挥平台/components/titleCompt";
    export default {
        components: {
            titleCompt,
        },
        props: {},
        data() {
            return {
                // 图表的数据
                rowData : [{
                    HYML_DM: "D",
                    HYML_MC: "D电力、热力、燃气及水生产和供应业",
                    HJHS: 12,
                    HJJE: 97506817.11,
                    XH: 1
                }, {
                    HYML_DM: "F",
                    HYML_MC: "F批发和零售业",
                    HJHS: 165,
                    HJJE: 10979674.51,
                    XH: 5
                }, {
                    HYML_DM: "Q",
                    HYML_MC: "Q卫生和社会工作",
                    HJHS: 1,
                    HJJE: 2585.67,
                    XH: 15
                }, {
                    HYML_DM: "R",
                    HYML_MC: "R文化、体育和娱乐业",
                    HJHS: 1,
                    HJJE: 1429218.97,
                    XH: 11
                }, {
                    HYML_DM: "K",
                    HYML_MC: "K房地产业",
                    HJHS: 7,
                    HJJE: 21472860.93,
                    XH: 3
                }, {
                    HYML_DM: "L",
                    HYML_MC: "L租赁和商务服务业",
                    HJHS: 21,
                    HJJE: 5961338.90,
                    XH: 6
                }, {
                    HYML_DM: "I",
                    HYML_MC: "I信息传输、软件和信息技术服务业",
                    HJHS: 9,
                    HJJE: 2558268.07,
                    XH: 9
                }, {
                    HYML_DM: "O",
                    HYML_MC: "O居民服务、修理和其他服务业",
                    HJHS: 3,
                    HJJE: 14427.44,
                    XH: 14
                }, {
                    HYML_DM: "A",
                    HYML_MC: "A农、林、牧、渔业",
                    HJHS: 5,
                    HJJE: 1540875.67,
                    XH: 10
                }, {
                    HYML_DM: "B",
                    HYML_MC: "B采矿业",
                    HJHS: 4,
                    HJJE: 850831.45,
                    XH: 13
                }, {
                    HYML_DM: "C",
                    HYML_MC: "C制造业",
                    HJHS: 122,
                    HJJE: 87530610.01,
                    XH: 2
                }, {
                    HYML_DM: "M",
                    HYML_MC: "M科学研究和技术服务业",
                    HJHS: 24,
                    HJJE: 20789437.03,
                    XH: 4
                }, {
                    HYML_DM: "H",
                    HYML_MC: "H住宿和餐饮业",
                    HJHS: 4,
                    HJJE: 899401.85,
                    XH: 12
                }, {
                    HYML_DM: "N",
                    HYML_MC: "N水利、环境和公共设施管理业",
                    HJHS: 2,
                    HJJE: 179.86,
                    XH: 16
                }, {
                    HYML_DM: "G",
                    HYML_MC: "G交通运输、仓储和邮政业",
                    HJHS: 26,
                    HJJE: 3186197.18,
                    XH: 8
                }, {
                    HYML_DM: "E",
                    HYML_MC: "E建筑业",
                    HJHS: 48,
                    HJJE: 4148413.71,
                    XH: 7
                }, ],
            };
        },
        watch: {},
        mounted() {
            this.init();
        },
        computed: {
            config() {
                return {
                    waitTime: 5000000,
                    data: this.rowData.map((row) => {
                        let name = row.HYML_MC;
                        return {
                            name: `<span style="margin-left:8px;text-align:left;">${name}</span>`,
                            value: Number(row.HJJE) + 1, //条的长度
                            //tb: (row.HJJE.toFixed(1)/10000).toFixed(1) + "万元", //同比
                            tb: this.digtalFormatUnit(row.HJJE, "元", false, true).value,
                            unit: this.digtalFormatUnit(row.HJJE, "元", false, true).unit,
                        };
                    }),
                    //unit: "%",
                    valueFormatter(p) {
                        return p.tb + p.unit;
                    },
                };
            },
            sql() {
                // let sql = ``;
                // return sql;
            },
        },
        methods: {
            init() {
                //this.getData();
            },
            //查询chart数据
            //   getData() {
            //     this.ajax({
            //       sql: this.sql,
            //       sqlTip: "-",
            //     }).then((res) => {
            //       this.rowData = res;
            //     });
  
  
            //   },
  
            // 排序
            onClickOrder(e) {
                // 根据行业名称、增速 切换排序去查询数据
            },
        },
    };
  </script>
  
  <style lang="scss" scoped>
    .tscxbox {
        height: 100%;
        text-align: left;
        &-chart {
            height: calc(100%);
        }
    }
  </style>